<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <div>
        <a-form layout="inline">
          <a-row :gutter="24">
            <a-col :md="6" :sm="24">
              <a-form-item label="专业组">
                <j-select-zyb placeholder="请选择专业组" v-model="falid" @input="zybChange"></j-select-zyb>
              </a-form-item>
            </a-col>
            <a-col :xl="3" :lg="3" :md="3" :sm="24">
              <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
                <edu-button type="7" @click="falid=''" icon="reload" title="清空"></edu-button>
              </span>
            </a-col>
            <a-col :md="6" :sm="24">
              <a-form-item label="课程性质">
                <j-dict-select-tag
                  v-model="kcxz"
                  placeholder="课程性质"
                  dictCode="edu_dev_open.ve_jw_kcxz,xzmc,id,is_able=1 and del_flag=0"
                ></j-dict-select-tag>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="6" :md="6" :sm="24">
              <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<!--                <a-button type="primary" @click="jwKecheng()" icon="search">搜索</a-button>-->
<!--                <a-button type="primary" @click="kcxz=''" icon="reload" style="margin-left: 8px">清空</a-button>-->
                <edu-button type="5" @click="jwKecheng()" icon="search" title="搜索"
                            style="margin-bottom: 0"></edu-button><edu-button type="7" @click="kcxz=''"
                                                                              icon="delete" title="清除"
                                                                              style="margin-bottom: 0"></edu-button>
              </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
    </div>
    <div v-if="!loading" style="display: flex;justify-content: center">
      <a-spin />
    </div>

    <BarStack v-if="loading" :stackType="true" title="计算机二组" :dataSeries="dataSeries" chartId="chartId1" :height="420" :axisLabelType="true" @select="select" />
  </a-card>
</template>

<script>
import Bar from '@/components/chart/Bar'
import { EduListMixin } from '@/mixins/EduListMixin'
import BarMultid from '@/components/chart/BarMultid'
import BarStack from '@/components/chart/BarStack'
import { getAction, deleteAction, putAction, postAction, httpAction } from '@/api/manage'
import {  getActionForBase } from '@/api/manage'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
import JSelectZyb from '@/components/kwglbiz/JSelectZyb'
import ACol from 'ant-design-vue/es/grid/Col'

export default {
  name: 'VeJwKctj',
  mixins: [EduListMixin],
  components: {
    ACol,
    Bar,
    BarMultid,
    BarStack,
    JDictSelectTag,
    JSelectZyb
  },
  data() {
    return {
      loading:false,
      disableMixinCreated: true,
      dataSeries:[],
      deps:{},
      falid:'',
      kcxz:''
    }
  },
  methods:{
    select(){

    },
    zybChange(code) {
      if (this.$refs.zyByZyb != null) {
        this.$refs.zyByZyb.initDictData(code)
      }
    },
    depSelect(value) {
      console.log(value)
      this.falid=value;
      this.jwKecheng();
    },
    jwKecheng(){
          let data={
            falid:this.falid,
            kcxz:this.kcxz
          }
          this.loading=false;
          getAction('/jxzy/jwKecheng/statistics',data).then(res=>{
            console.log(res);
            if(res.success){
                  let arr=res.result.zyzs;
                  this.dataSeries=[];
                  for(var i=0;i<arr.length;i++){
                    let json={
                      name:arr[i].yxmc,
                      data:{}
                    };
                    arr[i].kcxzs.forEach(ret=>{
                      json.data[ret.xzmc]=ret.count
                    })

                    this.dataSeries.push(json);
                  }
                  console.log(this.dataSeries);
                  this.loading=true
            }
          })
    },
  },
  created() {
    this.jwKecheng();
  }
}
</script>

<style></style>
